<template>
  <div class="h-full flex flex-col p-7">
    <div class="mb-[20px]">
      <span class="mr-5"> {{ $t('icl.data.category.initialize') }}</span>
      <a-popconfirm :cancel-text="$t('user.email.required11')" :ok-text="$t('user.verification-code.required1166')"
        :title="$t('user.verification-code.required11156611057722522')
          " @confirm="() => goCategory()">
        <a-button size="small" class="border-none hover:bg-[#3F8CFF] hover:bg-opacity-5 shadow">{{
          $t("icl.initialize") }}</a-button>
      </a-popconfirm>
    </div>
    <div class="mb-[20px]">
      <span class="mr-5">{{ $t('icl.data.item.initialize') }}</span>
      <a-popconfirm :cancel-text="$t('user.email.required11')" :ok-text="$t('user.verification-code.required1166')"
        :title="$t('user.verification-code.required11156611057722522')
          " @confirm="() => goDataItem()">
        <a-button size="small" class="border-none hover:bg-[#3F8CFF] hover:bg-opacity-5 shadow">{{
          $t("icl.initialize") }}</a-button>
      </a-popconfirm>
    </div>
    <div class="mb-[20px]">
      <span class="mr-5">{{ $t('icl.resend') }}</span>
      <a-popconfirm :cancel-text="$t('user.email.required11')" :ok-text="$t('user.verification-code.required1166')"
        :title="$t('user.verification-code.required11156611057722533')
          " @confirm="() => send()">
        <a-button size="small" class="border-none hover:bg-[#3F8CFF] hover:bg-opacity-5 shadow">{{
          $t("icl.send") }}</a-button>
      </a-popconfirm>
    </div>
    <a-textarea :rows="40" :placeholder="$t('icl.place.push')" v-model="text" />
  </div>
</template>

<script>
import {
  dataCategoryInitialize,
  dataItemInitialize,
  resend,
} from "@/api/configs";

export default {

  data() {
    return {


    };
  },
  created() {
  },
  mounted() {

  },
  methods: {
    async goCategory() {
      try {
        await dataCategoryInitialize()
        this.$message.success(this.$t('icl.dcc.succed'))

      } catch (error) {
        this.$message.error(this.$t('icl.dcc.ing'))
      }
    },

    async goDataItem() {
      try {
        await dataItemInitialize()
        this.$message.success(this.$t('icl.data.succed'))

      } catch (error) {
        this.$message.error(this.$t('icl.data.ing'))
      }
    },

    async send() {
      try {
        await resend({
          data: this.text
        });

      } catch (error) {
        console.log(error)
        this.$message.error(error)
      }
    },
  }
}
</script>

<style></style>
